//
// Created by 王乐 on 2022/2/8.
//

#ifndef LESTE_LECAMERA2DBEHAVIOUR_H
#define LESTE_LECAMERA2DBEHAVIOUR_H

#include "LeCameraBaseBehaviour.h"

enum Camera2D_Movement {
    C2M_UP,
    C2M_DOWN,
    C2M_LEFT,
    C2M_RIGHT
};

class LeCamera2DBehaviour : public LeCameraBaseBehaviour
{
public:
    LeCamera2DBehaviour();
    virtual ~LeCamera2DBehaviour();

    void Start() override;
    void Update() override;

public:
    glm::mat4 getViewMatrix() override;
    glm::mat4 getProjectionMatrix() override;

    void setCameraTarget(LeGameObject* target) override;
    void setCameraShakeMode(bool isShakeMode) override;

private:
    void processKeyboard(Camera2D_Movement direction);
    void processMouseScroll(float yoffset);

private:
    bool m_bFreeMove;
    float m_MoveSpeed;
    LeGameObject* m_pTargetGameObject;
    float m_FollowRatio;
    glm::vec3 m_FollowOffset;

    bool m_bIsPerspective;
    float mouseSensitivity;
    float zoom;

    //camera shake
    bool m_bShakeMode;
    float m_ShakeDuration;
    float m_ShakeTargetChangeTime;
    float m_ShakeStrength;

    float m_CurShakeDuration;
    float m_CurShakeTargetChangeTime;
};


#endif //LESTE_LECAMERA2DBEHAVIOUR_H
